<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:th="http://www.thymeleaf.org">
<head>
	 <meta charset="UTF-8">
	 <title th:replace="common/base::pagetitle"></title>
	 <link th:replace="common/base::static"/>
	 <style type="text/css">
		  .layui-form-label {
				width: 30%;
		  }
        .layui-input-inline {
            width: 50%;
        }
	 </style>
</head>
<body>
<div class="layui-form" style="padding: 20px 30px 0 0;">
	 <div class="layui-form-item">
		  <label class="layui-form-label">机构名称</label>
		  <div class="layui-input-inline">
				<input type="text" name="name" th:value="${editInfo.name}" lay-verify="required" placeholder="请输入机构名称" autocomplete="off" class="layui-input">
		  </div>
	 </div>
	 <div class="layui-form-item">
		  <label class="layui-form-label">机构证件号(统一社会信用代码)</label>
		  <div class="layui-input-inline">
				<input type="text" name="idNumber" th:value="${editInfo.idNumber}" lay-verify="required" placeholder="请输入统一社会信用代码" autocomplete="off" class="layui-input">
		  </div>
	 </div>
	 <div class="layui-form-item">
		  <label class="layui-form-label">法定代表人证件号</label>
		  <div class="layui-input-inline">
				<input type="text" name="orgLegalIdNumber" th:value="${editInfo.orgLegalIdNumber}"  lay-verify="identity" placeholder="请输入法人身份证号码" autocomplete="off" class="layui-input">
		  </div>
	 </div>
	 <div class="layui-form-item">
		  <label class="layui-form-label">法定代表人姓名</label>
		  <div class="layui-input-inline">
				<input type="text" name="orgLegalName" th:value="${editInfo.orgLegalName}"  lay-verify="required" placeholder="请输入法人姓名" autocomplete="off" class="layui-input">
		  </div>
	 </div>
	 <div class="layui-form-item layui-hide">
		  <input type="button" lay-submit="" lay-filter="kFormSubmit" id="kFormSubmit" value="确认添加">
		  <input type="text" name="id" th:value="${editInfo.id}" placeholder="保存ID" autocomplete="off" class="layui-input">
		  <!--        <input type="text" name="deptId" th:value="${editInfo.deptId}" placeholder="保存deptId" autocomplete="off" class="layui-input">-->
	 </div>
</div>

<script th:replace="common/base::context"></script>
<script th:replace="common/base::mainjs"></script>
<script th:src="@{/static/js/select-tree.js}"></script>
<script>
    layui.use(['form'], function () {
        var $ = layui.$, form = layui.form;

        //监听提交
        form.on('submit(kFormSubmit)', function (data) {
            var field = data.field; //获取提交的字段
            var index = parent.layer.getFrameIndex(window.name); //先得到当前iframe层的索引
            /*if (deptId) {
                field.deptId = deptId;
            }*/

            log('field=', field);

            //提交 Ajax 成功后，关闭当前弹层并重载表格
            $.ajax({
                type: req.type.post,
                url: BASE_WEB + 'esign/org/create',
                data: field,
                async: false,
                success: function (r) {
                    if (r.code === req.status.ok) {
                        parent.layui.table.reload('kContentTable'); //重载表格
                        parent.layer.close(index); //再执行关闭
                    } else {
                        wlbKit.errorMsg(r.msg);
                    }
                }
            });

        });
    })
</script>
</body>
</html>